package com.certapp.dao.mapper;

import com.certapp.dao.entity.TbQueryPage;
import com.certapp.dao.entity.TbQueryPageExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbQueryPageMapper {

    @Select({ "select", "id, cert_config_id, banner, cert_org, search_hint, bottom_log, explain_doc, filed_serial", "from tb_query_page", "where cert_config_id = #{certConfigId,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "banner", property = "banner", jdbcType = JdbcType.VARCHAR), @Result(column = "cert_org", property = "certOrg", jdbcType = JdbcType.VARCHAR), @Result(column = "search_hint", property = "searchHint", jdbcType = JdbcType.VARCHAR), @Result(column = "bottom_log", property = "bottomLog", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR) })
    TbQueryPage selectByCertConfigId(@Param("certConfigId") Integer certConfigId);

    @Update({ "update tb_query_page", "set banner = #{banner,jdbcType=VARCHAR},", "cert_org = #{certOrg,jdbcType=VARCHAR},", "search_hint = #{searchHint,jdbcType=VARCHAR},", "bottom_log = #{bottomLog,jdbcType=VARCHAR},", "explain_doc = #{explainDoc,jdbcType=VARCHAR},", "filed_serial = #{filedSerial,jdbcType=VARCHAR}", "where cert_config_id = #{certConfigId,jdbcType=INTEGER}" })
    int updateByCertConfigId(TbQueryPage record);

    @Delete({ "delete from tb_query_page", "where cert_config_id = #{certConfigId,jdbcType=INTEGER}" })
    int deleteByCertConfigId(@Param("certConfigId") Integer certConfigId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbQueryPageSqlProvider.class, method = "countByExample")
    long countByExample(TbQueryPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbQueryPageSqlProvider.class, method = "deleteByExample")
    int deleteByExample(TbQueryPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @Delete({ "delete from tb_query_page", "where id = #{id,jdbcType=INTEGER}" })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @Insert({ "insert into tb_query_page (cert_config_id, cert_org, ", "search_hint, explain_doc, ", "filed_serial, banner, ", "bottom_log)", "values (#{certConfigId,jdbcType=INTEGER}, #{certOrg,jdbcType=VARCHAR}, ", "#{searchHint,jdbcType=VARCHAR}, #{explainDoc,jdbcType=VARCHAR}, ", "#{filedSerial,jdbcType=VARCHAR}, #{banner,jdbcType=LONGVARCHAR}, ", "#{bottomLog,jdbcType=LONGVARCHAR})" })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insert(TbQueryPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbQueryPageSqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insertSelective(TbQueryPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbQueryPageSqlProvider.class, method = "selectByExampleWithBLOBs")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "cert_org", property = "certOrg", jdbcType = JdbcType.VARCHAR), @Result(column = "search_hint", property = "searchHint", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR), @Result(column = "filed_serial", property = "filedSerial", jdbcType = JdbcType.VARCHAR), @Result(column = "banner", property = "banner", jdbcType = JdbcType.LONGVARCHAR), @Result(column = "bottom_log", property = "bottomLog", jdbcType = JdbcType.LONGVARCHAR) })
    List<TbQueryPage> selectByExampleWithBLOBs(TbQueryPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbQueryPageSqlProvider.class, method = "selectByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "cert_org", property = "certOrg", jdbcType = JdbcType.VARCHAR), @Result(column = "search_hint", property = "searchHint", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR), @Result(column = "filed_serial", property = "filedSerial", jdbcType = JdbcType.VARCHAR) })
    List<TbQueryPage> selectByExample(TbQueryPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @Select({ "select", "id, cert_config_id, cert_org, search_hint, explain_doc, filed_serial, banner, ", "bottom_log", "from tb_query_page", "where id = #{id,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "cert_org", property = "certOrg", jdbcType = JdbcType.VARCHAR), @Result(column = "search_hint", property = "searchHint", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR), @Result(column = "filed_serial", property = "filedSerial", jdbcType = JdbcType.VARCHAR), @Result(column = "banner", property = "banner", jdbcType = JdbcType.LONGVARCHAR), @Result(column = "bottom_log", property = "bottomLog", jdbcType = JdbcType.LONGVARCHAR) })
    TbQueryPage selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbQueryPageSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbQueryPage record, @Param("example") TbQueryPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbQueryPageSqlProvider.class, method = "updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") TbQueryPage record, @Param("example") TbQueryPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbQueryPageSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") TbQueryPage record, @Param("example") TbQueryPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbQueryPageSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbQueryPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @Update({ "update tb_query_page", "set cert_config_id = #{certConfigId,jdbcType=INTEGER},", "cert_org = #{certOrg,jdbcType=VARCHAR},", "search_hint = #{searchHint,jdbcType=VARCHAR},", "explain_doc = #{explainDoc,jdbcType=VARCHAR},", "filed_serial = #{filedSerial,jdbcType=VARCHAR},", "banner = #{banner,jdbcType=LONGVARCHAR},", "bottom_log = #{bottomLog,jdbcType=LONGVARCHAR}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKeyWithBLOBs(TbQueryPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @Update({ "update tb_query_page", "set cert_config_id = #{certConfigId,jdbcType=INTEGER},", "cert_org = #{certOrg,jdbcType=VARCHAR},", "search_hint = #{searchHint,jdbcType=VARCHAR},", "explain_doc = #{explainDoc,jdbcType=VARCHAR},", "filed_serial = #{filedSerial,jdbcType=VARCHAR}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKey(TbQueryPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert({ "<script>", "insert into tb_query_page (cert_config_id, ", "cert_org, search_hint, ", "explain_doc, filed_serial, ", "banner, bottom_log)", "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.certConfigId,jdbcType=INTEGER}, ", "#{detail.certOrg,jdbcType=VARCHAR}, #{detail.searchHint,jdbcType=VARCHAR}, ", "#{detail.explainDoc,jdbcType=VARCHAR}, #{detail.filedSerial,jdbcType=VARCHAR}, ", "#{detail.banner,jdbcType=LONGVARCHAR}, #{detail.bottomLog,jdbcType=LONGVARCHAR})</foreach></script>" })
    int batchInsert(List<TbQueryPage> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_page
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbQueryPageSqlProvider.class, method = "getOneByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "cert_org", property = "certOrg", jdbcType = JdbcType.VARCHAR), @Result(column = "search_hint", property = "searchHint", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR), @Result(column = "filed_serial", property = "filedSerial", jdbcType = JdbcType.VARCHAR), @Result(column = "banner", property = "banner", jdbcType = JdbcType.LONGVARCHAR), @Result(column = "bottom_log", property = "bottomLog", jdbcType = JdbcType.LONGVARCHAR) })
    Optional<TbQueryPage> getOneByExample(TbQueryPageExample example);
}
